#
#
#
#
#

module Ph

  class Caption < Ph::Container
  
    def initialize(window)
      super()
      
      @title = Ph::Container.new
      @buttons = Ph::Container.new
			@window = window
      
      @body.add(@title, @buttons)

			@title.class_name = 'title'
			@buttons.class_name = 'buttons'

			@buttons.body.add( {
				:minimize => Ph::Image.new(Ph::Theme.image('actions/list-remove')),
				:maximize => Ph::Image.new(Ph::Theme.image('actions/list-add'))
			} )

			# TODO Fix these please.
			@buttons[:minimize].onclick = [
				@buttons[:minimize].hide,
				@buttons[:maximize].show,
				@window.hide
			]

			@buttons[:maximize].onclick = [
				@buttons[:maximize].hide,
				@buttons[:minimize].show,
				@window.show
			]

    end
   
	  # Sets Title of Window
    def title=(what)
      @title.body.clear
			@title.body.add what   
    end
    
    def title
      return @body[:titlebar].body[:text].body
    end
       
  end

end
